package com.eipc;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * 选手档案
 * @author x_liaolijun
 *
 * 2010-9-12 上午08:46:12
 *  
 * PlayerRecordActivity
 *
 */
public class TicketInfoActivity extends CommonActivity {
	
	private ListView mListView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.player_record);
		initView();
	}
	
	@Override
	protected void initView() {
		super.initView();
		mBar.setMiddleText(R.string.ticket_info); 
		mListView = (ListView)findViewById(R.id.list1);
		mListView.setAdapter(new ArrayAdapter<String>(this, R.layout.simple_list_item_1, android.R.id.text1, mRe.getStringArray(R.array.ticket_info_items)));
		mListView.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				String url = "";
				switch(position){
					case 0:
						url = "file:///android_asset/html/ticket_price.html";
						break;
					case 1:
						url = "file:///android_asset/html/box_price.html";
						break;
					case 2:
						url = "file:///android_asset/html/ticket_upgrade_method.html";
						break;
				}
				if(!"".equals(url)){
					Intent i = new Intent(TicketInfoActivity.this, WebViewActivity.class);
					i.putExtra("url", url);
					startActivityForResult(i,REQUEST_CODE_CHILD);
				}
				finish();
			}
		});
	}
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if(requestCode == REQUEST_CODE_CHILD && resultCode == RESULT_CANCELED){
			finish();
		}
	}
}
